package com.vilen;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * Created by vilen on 2016/11/30.
 */
public class H2Test {
    public static void main(String[] args) {
        try{
            Class.forName("org.h2.Driver");
            Connection conn = DriverManager.
                    getConnection("jdbc:h2:C:\\my_db\\h2Test\\test", "sa", "");
            // add application code here
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT * FROM TEST ");
            while (rs.next()) {
                System.out.println(rs.getInt("ID") + "," + rs.getString("NAME"));
            }
            conn.close();
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
}
